<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
	
		</style>
		
		<script type="text/javascript">
			window.οnlοad=function()
			{
				var oTab=document.getElementById('tab1')
				var oldColor='';
			   function toColor()
			   {
			   	for(var i=0;i<oTab.tBodies[0].rows.length;i++)
			   //隔行变色
			   {    
			   	    oTab.tBodies[0].rows[i].οnmοuseοver=function()
			   	    {  //鼠标移入变色
			   	    	oldColor=this.style.background;
			   	    	this.style.background='green';
			   	    };
			   	    oTab.tBodies[0].rows[i].οnmοuseοut=function()
			   	    {   //鼠标移出恢复原来颜色
			   	    	this.style.background=oldColor;
			   	    }
			   	    if(i%2){
			   	    	oTab.tBodies[0].rows[i].style.background='';
			   	    }
			   	    else
			   	    {
			   	    	oTab.tBodies[0].rows[i].style.background='#ccc';
			   	    } 
			   }
			   }
			   toColor();   
			}
		</script>
	</head>
	<body>
		<table border="1" id="tab1" width="500">
			<thead>
				<td>ID</td>
				<td>姓名</td>
				<td>年龄</td>
				<td>操作</td>
			</thead>
			<tbody>
				<tr>
					<td>1</td>
					<td>张三</td>
					<td>34</td>
					<td></td>
				</tr>
				<tr>
					<td>2</td>
					<td>李四</td>
					<td>11</td>
					<td> </td>
				</tr>
				<tr>
					<td>3</td>
					<td>王五</td>
					<td>34</td>
					<td></td>
				</tr>
				<tr>
					<td>4</td>
					<td>李麻子</td>
					<td>39</td>
					<td></td>
				</tr>
				<tr>
					<td>5</td>
					<td>HuHansan</td>
					<td>39</td>
					<td></td>
				</tr>
			</tbody>
		</table>
	</body>
</html>